package com.bw.widget_sdk;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class FragmentAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragment_list;
    private List<String> string_list;

    public FragmentAdapter(@NonNull FragmentManager fm, List<Fragment> fragment_list, List<String> string_list) {
        super(fm);
        this.fragment_list = fragment_list;
        this.string_list = string_list;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragment_list.get(position);
    }

    @Override
    public int getCount() {
        return fragment_list.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return string_list.get(position);
    }
}
